package com.roncoo.education.system.service.admin;

import com.roncoo.education.common.core.base.Page;
import com.roncoo.education.common.core.base.Result;
import com.roncoo.education.system.service.admin.biz.AdminMinioUploadingBiz;
import com.roncoo.education.system.service.admin.req.AdminMinioUploadingEditReq;
import com.roncoo.education.system.service.admin.req.AdminMinioUploadingPageReq;
import com.roncoo.education.system.service.admin.req.AdminMinioUploadingSaveReq;
import com.roncoo.education.system.service.admin.resp.AdminMinioUploadingPageResp;
import com.roncoo.education.system.service.admin.resp.AdminMinioUploadingViewResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * ADMIN-
 *
 * @author wujing
 */
@Api(tags = "ADMIN-")
@RestController
@RequiredArgsConstructor
@RequestMapping("/course/admin/minio/uploading")
public class AdminMinioUploadingController {

    @NotNull
    private final AdminMinioUploadingBiz biz;

    @ApiOperation(value = "分页", notes = "分页")
    @PostMapping(value = "/page")
    public Result<Page<AdminMinioUploadingPageResp>> page(@RequestBody AdminMinioUploadingPageReq req) {
        return biz.page(req);
    }

    @ApiOperation(value = "添加", notes = "添加")
    @PostMapping(value = "/save")
    public Result<String> save(@RequestBody @Valid AdminMinioUploadingSaveReq req) {
        return biz.save(req);
    }

    @ApiOperation(value = "查看", notes = "查看")
    @ApiImplicitParam(name = "id", value = "主键ID", dataTypeClass = Long.class, paramType = "query", required = true)
    @GetMapping(value = "/view")
    public Result<AdminMinioUploadingViewResp> view(@RequestParam String id) {
        return biz.view(id);
    }

    @ApiOperation(value = "修改", notes = "修改")
    @PutMapping(value = "/edit")
    public Result<String> edit(@RequestBody @Valid AdminMinioUploadingEditReq req) {
        return biz.edit(req);
    }

    @ApiOperation(value = "删除", notes = "删除")
    @ApiImplicitParam(name = "id", value = "主键ID", dataTypeClass = Long.class, paramType = "query", required = true)
    @DeleteMapping(value = "/delete")
    public Result<String> delete(@RequestParam String id) {
        return biz.delete(id);
    }
}
